use std::{net::IpAddr, sync::Arc, thread};

use bytes::BytesMut;
use tokio::net::UdpSocket;
use tools::{error::Error, ResultEx};
use tracing::{error, info, trace};

#[test]
fn test_udp() {
	println!("开始执行");
	let rt = tools::global_defin::tokio_runtime::get_rt();
	let _rt_guard = rt.enter();
	let _log = tools::global_defin::trace_log::init_tracing_log();
	let (t, mut r) = tokio::sync::mpsc::channel(20);

	rt.spawn(async move {
		loop {
			match r.recv().await {
				Some(v) => {
					info!("收到消息:{}", v);
				}
				None => {
					error!("发送端退出");
					return;
				}
			}
		}
	});

	rt.spawn(async move {
		t.try_send(200);
	});

	thread::park();
}
